﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
using Coldairarrow.Util;
using Castle.Core;
using System.Net.NetworkInformation;
using OfficeOpenXml.Style;
using Org.BouncyCastle.Math;
using System.Drawing;
using Coldairarrow.Business.Interface;
using Org.BouncyCastle.Utilities;
using System.Globalization;
using System.Diagnostics;
using static org.apache.zookeeper.ZooKeeper;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 退货列表
    /// </summary>
    /// 
    public class YDReturnsDTO
    {
        public string status { get; set; }
        public Result result { get; set; }

        public class Result
        {
            /// <summary>
            /// 订单列表
            /// </summary>
            public List<Returns> returns { get; set; }
            /// <summary>
            /// 下页信息
            /// </summary>
            public Paging paging { get; set; }

        }
        


        public class Returns
        {
            public string RowId { get; set; }
            /// <summary>
            /// ID	
            /// </summary>
            public string ID_ { get; set; }
            /// <summary>
            /// id	
            /// </summary>
            public string id { get; set; }
            /// <summary>
            /// 发货方式	
            /// </summary>
            public string ShipmentType { get; set; }
            /// <summary>
            /// 店铺id
            /// </summary>
            public string SellerId { get; set; }


            /// <summary>
            /// 订单号	
            /// </summary>
            public string orderId { get; set; }
            /// <summary>
            /// 创建日期	
            /// </summary>
            public string creationDate { get; set; }
            /// <summary>
            /// 更新日期	
            /// </summary>
            public string updateDate { get; set; }
            /// <summary>
            ///退货状态
            /// </summary>
            public string refundStatus_ { get; set; }
            public string refundStatus
            {
                get { return refundStatus_; }
                set
                {
                    if (value == "STARTED_BY_USER") refundStatus_ = "客户创建";
                    else if (value == "REFUND_IN_PROGRESS") refundStatus_ = "待退款";
                    else if (value == "REFUNDED") refundStatus_ = "已完成";
                    else if (value == "FAILED") refundStatus_ = "无法退款";
                    else if (value == "WAITING_FOR_DECISION") refundStatus_ = "待确认";
                    else if (value == "DECISION_MADE") refundStatus_ = "确认退货";
                    else if (value == "REFUNDED_WITH_BONUSES") refundStatus_ = "积分促销退款";
                    else if (value == "REFUNDED_BY_SHOP") refundStatus_ = "商店退款";
                    else if (value == "COMPLETE_WITHOUT_REFUND") refundStatus_ = "无需退款";
                    else if (value == "CANCELLED") refundStatus_ = "已取消";
                    else if (value == "UNKNOWN") refundStatus_ = "未知";
                    else refundStatus_ = value;

                }
            }

            /// <summary>
            /// 退货物流地点
            /// </summary>
            public LogisticPickupPoint logisticPickupPoint { get; set; }

            /// <summary>
            /// 取货点名称
            /// </summary>
            public string logisticPickupPoint_name { get; set; }
            /// <summary>
            /// 物流附加说明
            /// </summary>
            public string logisticPickupPoint_instruction { get; set; }
            /// <summary>
            /// 物流类型
            /// </summary>
            public string logisticPickupPoint_type { get; set; }
            /// <summary>
            /// 物流ID
            /// </summary>
            public string logisticPickupPoint_logisticPartnerId { get; set; }

            /// <summary>
            /// 取件国家
            /// </summary>
            public string address_country { get; set; }
            /// <summary>
            /// 取件邮编
            /// </summary>
            public string address_postcode { get; set; }
            /// <summary>
            /// 取件城市
            /// </summary>
            public string address_city { get; set; }
            /// <summary>
            /// 取件街道
            /// </summary>
            public string address_street { get; set; }
            /// <summary>
            /// 取件房号
            /// </summary>
            public string address_house { get; set; }
            public class LogisticPickupPoint
            {
                /// <summary>
                /// 取货点ID
                /// </summary>
                public string id { get; set; }
                /// <summary>
                /// 取货点名称
                /// </summary>
                public string name { get; set; }
                /// <summary>
                /// 附加说明
                /// </summary>
                public string instruction { get; set; }
                /// <summary>
                /// 物流类型
                /// </summary>
                public string type { get; set; }
                /// <summary>
                /// 物流ID
                /// </summary>
                public string logisticPartnerId { get; set; }
                /// <summary>
                /// 取件点的地址
                /// </summary>
                public Address address { get; set; }
                public class Address
                {
                    /// <summary>
                    /// 国家
                    /// </summary>
                    public string country { get; set; }
                    /// <summary>
                    /// 邮编
                    /// </summary>
                    public string postcode { get; set; }
                    /// <summary>
                    /// 城市
                    /// </summary>
                    public string city { get; set; }
                    /// <summary>
                    /// 街道
                    /// </summary>
                    public string street { get; set; }
                    /// <summary>
                    /// 房号
                    /// </summary>
                    public string house { get; set; }

                }
            }
            /// <summary>
            /// 产品价格(不包括运费，折扣)	
            /// </summary>
            public string shipmentRecipientType { get; set; }
            /// <summary>
            /// 状态
            /// </summary>
            public string shipmentStatus_;
            public string shipmentStatus {
                get { return shipmentStatus_; }
                set
                {
                    if (value == "CREATED") shipmentStatus_ = "创建中";
                    else if (value == "RECEIVED") shipmentStatus_ = "已接收";
                    else if (value == "IN_TRANSIT") shipmentStatus_ = "在途中";
                    else if (value == "READY_FOR_PICKUP") shipmentStatus_ = "准备收货";
                    else if (value == "PICKED") shipmentStatus_ = "收货中";
                    else if (value == "LOST") shipmentStatus_ = "丢失";
                    else if (value == "EXPIRED") shipmentStatus_ = "已过期";
                    else if (value == "CANCELLED") shipmentStatus_ = "已取消";
                    else if (value == "FULFILMENT_RECEIVED") shipmentStatus_ = "已收到";
                    else if (value == "PREPARED_FOR_UTILIZATION") shipmentStatus_ = "准备回收";
                    else if (value == "NOT_IN_DEMAND") shipmentStatus_ = "无需求";
                    else if (value == "UTILIZED") shipmentStatus_ = "已使用";
                    else if (value == "READY_FOR_EXPROPRIATION") shipmentStatus_ = "准备使用";
                    else if (value == "RECEIVED_FOR_EXPROPRIATION") shipmentStatus_ = "因征用而接收";
                    else if (value == "UNKNOWN") shipmentStatus_ = "未知";
                    else shipmentStatus_ = value;

                }
            }
            /// <summary>
            /// 退款金额
            /// </summary>
            //public string refundAmount { get; set; }
            /// <summary>
            /// 退货类型
            /// </summary>
            public string returnType_;
            public string returnType {
                get { return returnType_; }
                set
                {
                    if (value == "UNREDEEMED") returnType_ = "未购买";
                    else if (value == "RETURN") returnType_ = "退款";
                    else returnType_ = value;

                }
            }
            /// <summary>
            /// 快速退货
            /// </summary>
            public string fastReturn { get; set; }
            /// <summary>
            /// 退款金额	
            /// </summary>
            public Amount amount { get; set; }
            /// <summary>
            /// 退款金额
            /// </summary>
            public string amount_value { get; set; }
            /// <summary>
            /// 币别
            /// </summary>
            public string amount_currencyId { get; set; }
            public class Amount
            {
                /// <summary>
                /// 金额类型
                /// </summary>
                public string value { get; set; }
                /// <summary>
                /// 币别
                /// </summary>
                public string currencyId { get; set; }

            }

            /// <summary>
            /// 退货明细
            /// </summary>
            public List<Items> items { get; set; }
            /// <summary>
            /// SKU
            /// </summary>
            public string items_marketSku { get; set; }
            /// <summary>
            /// MSKU
            /// </summary>
            public string items_shopSku { get; set; }

            /// <summary>
            /// 数量
            /// </summary>
            public string items_count { get; set; }

            /// <summary>
            /// 评论
            /// </summary>
            public string decisions_comment { get; set; }
            /// <summary>
            /// 退货方式
            /// </summary>
            public string decisions_reasonType { get; set; }
            /// <summary>
            /// 退货原因
            /// </summary>
            public string decisions_subreasonType { get; set; }
            /// <summary>
            /// 处理方式
            /// </summary>
            public string decisions_decisionType { get; set; }
            /// <summary>
            ///  物流类型
            /// </summary>
            public string instances_stockType { get; set; }
            /// <summary>
            /// 物流状态
            /// </summary>
            public string instances_status { get; set; }
            /// <summary>
            /// 商品识别码
            /// </summary>
            public string instances_cis { get; set; }
            /// <summary>
            /// 国际标识符
            /// </summary>
            public string instances_imei { get; set; }
            /// <summary>
            /// 运费赔偿金额
            /// </summary>
            public string partnerCompensationAmount_value { get; set; }
            /// <summary>
            /// 运费赔偿币别
            /// </summary>
            public string partnerCompensationAmount_currencyId { get; set; }

            /// <summary>
            /// 邮件编码
            /// </summary>
            public string trackCode { get; set; }
            public class Items
            {
                /// <summary>
                /// SKU
                /// </summary>
                public string marketSku { get; set; }
                /// <summary>
                /// MSKU
                /// </summary>
                public string shopSku { get; set; }

                /// <summary>
                /// 数量
                /// </summary>
                public string count { get; set; }
                /// <summary>
                /// 退货方式
                /// </summary>
                public List<Decisions> decisions { get; set; }

                public class Decisions
                {
                    /// <summary>
                    /// ID
                    /// </summary>
                    public string returnItemId { get; set; }
                    /// <summary>
                    /// 数量
                    /// </summary>
                    public string count { get; set; }
                    /// <summary>
                    /// 评论
                    /// </summary>
                    public string comment { get; set; }
                    /// <summary>
                    /// 退款原因
                    /// </summary>
                    public string reasonType_;
                    public string reasonType
                    {
                        get { return reasonType_; }
                        set
                        {
                            if (value == "BAD_QUALITY") reasonType_ = "有缺陷的产品（有缺点）";
                            else if (value == "DOES_NOT_FIT") reasonType_ = "产品不合适";
                            else if (value == "WRONG_ITEM") reasonType_ = "交付了错误的产品";
                            else if (value == "DAMAGE_DELIVERY") reasonType_ = "产品在交付过程中损坏";
                            else if (value == "LOYALTY_FAIL") reasonType_ = "不确定性的人为损坏";
                            else if (value == "CONTENT_FAIL") reasonType_ = "与描述不符";
                            else if (value == "DELIVERY_FAIL") reasonType_ = "货物没有到达";
                            else if (value == "UNKNOWN") reasonType_ = "未指定";
                            else reasonType_ = value;

                        }
                    }
                    /// <summary>
                    /// 退货原因
                    /// </summary>
                    public string subreasonType_;
                    public string subreasonType
                    {
                        get { return subreasonType_; }
                        set
                        {
                            if (value == "DOES_NOT_FIT") subreasonType_ = "不适合";
                            else if (value == "USER_DID_NOT_LIKE") subreasonType_ = "不喜欢";
                            else if (value == "USER_CHANGED_MIND") subreasonType_ = "改变了购买的想法";
                            else if (value == "DELIVERED_TOO_LONG") subreasonType_ = "交货时间太长";
                            else if (value == "BAD_PACKAGE") subreasonType_ = "包装损坏";
                            else if (value == "DAMAGED") subreasonType_ = "有划痕";
                            else if (value == "NOT_WORKING") subreasonType_ = "无法运行";
                            else if (value == "INCOMPLETENESS") subreasonType_ = "缺少配件";
                            else if (value == "WRAPPING_DAMAGED") subreasonType_ = "运输包裹损坏";
                            else if (value == "ITEM_WAS_USED") subreasonType_ = "产品有使用痕迹";
                            else if (value == "BROKEN") subreasonType_ = "货物损坏";
                            else if (value == "BAD_FLOWERS") subreasonType_ = "产品质量不行";
                            else if (value == "WRONG_ITEM") subreasonType_ = "发错货";
                            else if (value == "WRONG_COLOR") subreasonType_ = "颜色不匹配";
                            else if (value == "DID_NOT_MATCH_DESCRIPTION") subreasonType_ = "产品描述或特征与实物不符";
                            else if (value == "WRONG_ORDER") subreasonType_ = "其他人的订单已送达";
                            else if (value == "WRONG_AMOUNT_DELIVERED") subreasonType_ = "产品数量不正确";
                            else if (value == "PARCEL_MISSING") subreasonType_ = "缺少部分订单";
                            else if (value == "INCOMPLETE") subreasonType_ = "订单未完全交付";
                            else if (value == "UNKNOWN") subreasonType_ = "未指定原因的详细信息";
                            else subreasonType_ = value;

                        }
                    }
                    /// <summary>
                    /// 处理方式
                    /// </summary>
                    public string decisionType_;
                    public string decisionType {
                        get { return decisionType_; }
                        set
                        {
                            if (value == "REFUND_MONEY") decisionType_ = "将钱退还给买方";
                            else if (value == "REFUND_MONEY_INCLUDING_SHIPMENT") decisionType_ = "退还产品和运费";
                            else if (value == "REPAIR") decisionType_ = "修复产品";
                            else if (value == "REPLACE") decisionType_ = "替换产品";
                            else if (value == "SEND_TO_EXAMINATION") decisionType_ = "将产品进行检查";
                            else if (value == "DECLINE_REFUND") decisionType_ = "拒绝退款";
                            else if (value == "OTHER_DECISION") decisionType_ = "其他解决方案";
                            else if (value == "UNKNOWN") decisionType_ = "未指定";
                            else decisionType_ = value;

                        }
                    }
                    /// <summary>
                    /// 退款金额
                    /// </summary>
                    //public string refundAmount { get; set; }
                    /// <summary>
                    /// 退款金额
                    /// </summary>
                    public YDReturnsDTO.Returns.Amount amount { get; set; }

                    /// <summary>
                    /// 退货运费赔偿
                    /// </summary>
                    public YDReturnsDTO.Returns.Amount partnerCompensationAmount { get; set; }

                    
                    /// <summary>
                    /// 退货运费赔偿
                    /// </summary>
                    //public string partnerCompensation { get; set; }

                }
                /// <summary>
                /// 物流信息
                /// </summary>
                public List<Instances> instances { get; set; }
               
                public class Instances
                {
                    /// <summary>
                    /// 库存的类型
                    /// </summary>
                    public string stockType { get; set; }
                    /// <summary>
                    /// 物流状态
                    /// </summary>
                    public string status { get; set; }
                    /// <summary>
                    /// 商品识别码
                    /// </summary>
                    public string cis { get; set; }
                    /// <summary>
                    /// 国际标识符
                    /// </summary>
                    public string imei { get; set; }

                }
                /// <summary>
                /// 邮件代码
                /// </summary>
                public List<Tracks> tracks { get; set; }

                
                public class Tracks
                {
                    /// <summary>
                    /// 邮件代码
                    /// </summary>
                    public string trackCode { get; set; }

                }



            }


            
        }


        public class Paging
        {
            /// <summary>
            /// 下页索引
            /// </summary>
            public string nextPageToken { get; set; }

        }


    }


    public class Returns
    {
        public string RowId { get; set; }
        /// <summary>
        /// ID	
        /// </summary>
        public string ID_ { get; set; }
        /// <summary>
        /// id	
        /// </summary>
        public string id { get; set; }
        /// <summary>
        /// 发货方式	
        /// </summary>
        public string ShipmentType { get; set; }
        /// <summary>
        /// 店铺id
        /// </summary>
        public string SellerId { get; set; }


        /// <summary>
        /// 订单号	
        /// </summary>
        public string orderId { get; set; }
        /// <summary>
        /// 创建日期	
        /// </summary>
        public string creationDate { get; set; }
        /// <summary>
        /// 更新日期	
        /// </summary>
        public string updateDate { get; set; }
        /// <summary>
        ///退货状态
        /// </summary>
        public string refundStatus { get; set; }

        /// <summary>
        /// 取货点名称
        /// </summary>
        public string logisticPickupPoint_name { get; set; }
        /// <summary>
        /// 物流附加说明
        /// </summary>
        public string logisticPickupPoint_instruction { get; set; }
        /// <summary>
        /// 物流类型
        /// </summary>
        public string logisticPickupPoint_type { get; set; }
        /// <summary>
        /// 物流ID
        /// </summary>
        public string logisticPickupPoint_logisticPartnerId { get; set; }

        /// <summary>
        /// 取件国家
        /// </summary>
        public string address_country { get; set; }
        /// <summary>
        /// 取件邮编
        /// </summary>
        public string address_postcode { get; set; }
        /// <summary>
        /// 取件城市
        /// </summary>
        public string address_city { get; set; }
        /// <summary>
        /// 取件街道
        /// </summary>
        public string address_street { get; set; }
        /// <summary>
        /// 取件房号
        /// </summary>
        public string address_house { get; set; }
        /// <summary>
        /// 产品价格(不包括运费，折扣)	
        /// </summary>
        public string shipmentRecipientType { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public string shipmentStatus { get; set; }
        /// <summary>
        /// 退货类型
        /// </summary>
        public string returnType { get; set; }
        /// <summary>
        /// 快速退货
        /// </summary>
        public string fastReturn { get; set; }
        /// <summary>
        /// 退款金额
        /// </summary>
        public string amount_value { get; set; }
        /// <summary>
        /// 币别
        /// </summary>
        public string amount_currencyId { get; set; }

        /// <summary>
        /// SKU
        /// </summary>
        public string items_marketSku { get; set; }
        /// <summary>
        /// MSKU
        /// </summary>
        public string items_shopSku { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public string items_count { get; set; }

        /// <summary>
        /// 评论
        /// </summary>
        public string decisions_comment { get; set; }
        /// <summary>
        /// 退货方式
        /// </summary>
        public string decisions_reasonType { get; set; }
        /// <summary>
        /// 退货原因
        /// </summary>
        public string decisions_subreasonType { get; set; }
        /// <summary>
        /// 处理方式
        /// </summary>
        public string decisions_decisionType { get; set; }
        /// <summary>
        ///  物流类型
        /// </summary>
        public string instances_stockType { get; set; }
        /// <summary>
        /// 物流状态
        /// </summary>
        public string instances_status { get; set; }
        /// <summary>
        /// 商品识别码
        /// </summary>
        public string instances_cis { get; set; }
        /// <summary>
        /// 国际标识符
        /// </summary>
        public string instances_imei { get; set; }
        /// <summary>
        /// 运费赔偿金额
        /// </summary>
        public string partnerCompensationAmount_value { get; set; }
        /// <summary>
        /// 运费赔偿币别
        /// </summary>
        public string partnerCompensationAmount_currencyId { get; set; }

        /// <summary>
        /// 邮件编码
        /// </summary>
        public string trackCode { get; set; }
     


    }


}
